<template>
  <div v-loading="loading" element-loading-background="rgba(0, 0, 0, 0.4)" style="height: 100%;">
    <div class="Fxpg_cur listTablesOther">
      <div class="RightCardTitle">降雨监测</div>
      <div class="tabel_common tabel_commons">
        <div class="table">
          <div class="thead">
            <div class="tr">
              <div class="th"> 时间 </div>
              <div class="th"> 面雨量<br/>(mm) </div>
              <div class="th"> 放大量<br/>(mm) </div>
              <div class="th"> 预演面雨量<br/>(mm) </div>
              <!-- <div class="th"> 风险点建议 </div> -->
            </div>
          </div>
          <el-scrollbar style="height:45vh; width: 100%;" class="el_scrollbar">
            <div class="tbody">
              <template v-if=" rainwaterList.stPList.length <=0 ">
                <div slot="no-results" class="noData" style="background-position: center 86%;padding-top: 70%;">暂无数据</div>
              </template>
              <div v-if="rainwaterList.stPList" class="tr" v-for="dict in rainwaterList.stPList" :key="dict.ewName" @click="planDetailsRowClick">
                  <!-- :class="['tr', PionId == dict.id ? 'ta' : '']"> -->
                  <div class="td"> {{ dict.tm | dateformat }} </div>
                  <div class="td"> {{ dict.arealP }} </div>
                  <div class="td"> {{ dict.areaBigP }} </div>
                  <div class="td"> {{ dict.rehearsalP }} </div>
              </div>
            </div>
          </el-scrollbar>
        </div>
      </div>
    </div>
    <!-- 最大雨量重现期统计 -->
    <div class="RightCardTitle">最大雨量重现期统计</div>
    <!-- <table id="myTable">
      <thead>
        <tr>
          <th class="blue-bold">1小时</th>
          <th class="blue-bold">3小时</th>
          <th class="blue-bold">6小时</th>
          <th class="blue-bold">24小时</th>
        </tr>
      </thead>
      <tbody>
        <tr v-for="(item, index) in tableData" :key="index">
          <td :style="{ backgroundColor: item.name === '王小虎' ? 'blue' : item.name === '2' ? 'red' : item.name === '3' ? 'purple' : '' }">{{ item.date }}</td>
          <td :style="{ backgroundColor: item.name === '王小虎' ? 'blue' : item.name === '2' ? 'red' : item.name === '3' ? 'purple' : '' }">{{ item.date }}</td>
          <td :style="{ backgroundColor: item.name === '王小虎' ? 'blue' : item.name === '2' ? 'red' : item.name === '3' ? 'purple' : '' }">{{ item.name }}</td>
          <td :style="{ backgroundColor: item.name === '王小虎' ? 'blue' : item.name === '2' ? 'red' : item.name === '3' ? 'purple' : '' }">{{ item.date }}</td>
        </tr>
      </tbody>
    </table> -->

    <div class="tableRainwater listTables">
      <!-- <div v-if="wscdPRfPList.length>0" class="gray-box"> -->
      <div  class="gray-box">
        <template v-if=" wscdPRfPList && wscdPRfPList.length <=0 ">
          <div slot="no-results" class="noData" style="background-position: center 70%; padding-top: 40%; width: 100px;">暂无数据</div>
        </template>
        <div class="gray-right" v-if="wscdPRfPList.length>0">
          <div  v-for="(item, index) in wscdPRfPList" :key="index"  class="gray-item">
            <p v-if="item.step === 60" class="td-time">1小时</p>
            <p v-if="item.step === 180" class="td-time">3小时</p>
            <p v-if="item.step === 360" class="td-time">6小时</p>
            <p v-if="item.step === 1440" class="td-time">24小时</p>
            <div class="td-content">
              <div>
                <p class="content_style">{{ item.p?item.p + 'mm':'-'  }}</p>
                <!-- <p  class="content_style" :style="{background:item.remark}">{{ item.rfP }}</p> -->
                <p class="content_style">
                  <span class="tag" :style="{background:item.remark}">{{item.rfP? item.rfP : '-' }}</span>
                </p>
                <!-- <p  class="content_style" :style="{background:item.remark,letterSpacing:(-1.5)+'px'}">{{ item.rcint }}</p> -->
                <p  class="content_style2" :style="{letterSpacing:(-1.5)+'px'}">{{ item.rcint }}</p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    
    <!-- 以下为原始代码 -->
    <!-- <div class="RightCardTitle">降雨监测</div>
    <div class="tableRainwater listTables">
      <el-table
        class="tainwatertable"
        :data="rainwaterList.stPList"
        fit
        style=""
        @row-click="planDetailsRowClick"
      >
        <template slot="empty">
          <span>无数据</span>
        </template>
        <el-table-column prop="name" align="center" label="时间">
          <template slot-scope="scope">
            <span> {{ scope.row.tm | dateformat }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="arealP" align="center" label="面雨量(mm)" />
        <el-table-column prop="areaBigP" align="center" label="放大量(mm)" />
        <el-table-column prop="rehearsalP" align="center" label="预演面雨量(mm)" />
      </el-table>
      <div> -->
        <!-- <div v-if="rainwaterList.stPRfPList.length>0" class="gray-box">
          <div class="gray-bg td-left">
            最大<br>点雨量
          </div>
          <div class="gray-right">
            <div v-for="(item, index) in rainwaterList.stPRfPList" :key="index" class="gray-item">
              <p v-if="item.step === 60" class="td-time">1小时</p>
              <p v-if="item.step === 180" class="td-time">3小时</p>
              <p v-if="item.step === 360" class="td-time">6小时</p>
              <p v-if="item.step === 1440" class="td-time">24小时</p>
              <div class="td-content">
                <div>
                  <p>{{ item.p }}</p>
                  <p :style="{background:item.remark}">{{ item.rfP }}</p>
                  <p :style="{background:item.remark,letterSpacing:(-2)+'px'}">{{ item.rcint }}</p>
                </div>
              </div>
            </div>
          </div>
        </div> -->
        <!-- <div v-if="wscdPRfPList.length>0" class="gray-box">
          <div class="gray-bg td-left">
            最大雨量重现期统计
          </div>
          <div class="gray-right">
            <div v-for="(item, index) in wscdPRfPList" :key="index" class="gray-item">
              <p v-if="item.step === 60" class="td-time">1小时</p>
              <p v-if="item.step === 180" class="td-time">3小时</p>
              <p v-if="item.step === 360" class="td-time">6小时</p>
              <p v-if="item.step === 1440" class="td-time">24小时</p>
              <div class="td-content">
                <div>
                  <p>{{ item.p }}</p>
                  <p :style="{background:item.remark}">{{ item.rfP }}</p>
                  <p :style="{background:item.remark,letterSpacing:(-1.5)+'px'}">{{ item.rcint }}</p>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div> -->
    <!-- <div class="RightCardTitle">降雨监测</div>
    <div class="tableoreca">
      <el-table
        :data="rainwaterList.forecastPList"
        fit
        style="width: 100%;height: 100%;"
        @row-click="planDetailsRowClick"
      >
        <template slot="empty">
          <span>无数据</span>
        </template>
        <el-table-column prop="name" width="150" align="center" label="预报时间">
          <template slot-scope="scope">
            <span> {{ scope.row.sinceTime | dateformat }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="p" align="center" label="面雨量(mm)" />
      </el-table>
    </div> -->
  </div>
</template>
<script>
import {
    GetRehearsalPZ
} from '@/api/xuna.js'
export default {
    name: 'Rainwater',
    data() {
        return {
            rainwaterList: {
                forecastPList: [],
                stPList: [],
                stPRfPList: [],
                wscdPRfPList: []
            },
            wscdPRfPList:[],
            loading: false,
            tableData: [{
              date: '2016-05-02',
              name: '王小虎',
              address: '上海市普陀区金沙江路 1518 弄'
            }, {
              date: '2016-05-04',
              name: '王小虎',
              address: '上海市普陀区金沙江路 1517 弄'
            }, {
              date: '2016-05-01',
              name: '王小虎',
              address: '上海市普陀区金沙江路 1519 弄'
            }, {
              date: '2016-05-03',
              name: '王小虎',
              address: '上海市普陀区金沙江路 1516 弄'
            }]
        }
    },
    methods: {
        getGetRehearsalPZ(id) {
            this.loading = true
            GetRehearsalPZ({ id: id }).then((res) => {
               // console.log(res)
                this.loading = false
                this.rainwaterList = res.data;

                let wscdPRfPListarrs =  res.data.wscdPRfPList.length?res.data.wscdPRfPList:[];
                let wscdPRfPListarr = wscdPRfPListarrs.filter(item=>{
                   return  item.rcint
                  //return Number(item.step)/60 == 1 || Number(item.step)/60 == 3 || Number(item.step)/60 == 6 || Number(item.step)/60 == 24
                });
                // console.log(wscdPRfPListarr)
                this.wscdPRfPList = wscdPRfPListarr || [];
                console.log('数据',this.wscdPRfPList)
            }).catch(err=>{
               this.loading = false;
            })
        },
        planDetailsRowClick(event) {
            console.log(event)
        }
    }
}
</script>
<style lang="less" scoped>
.gray-box{
    margin: 0 auto;
    font-size: 12px;
    display: flex;
    justify-content: center;
    .td-left{
      display: flex;
      line-height: 18px;
      width: 50px;
      align-items: center;
      text-align: center;
      border: 1px solid #3492d2;
      justify-content: center;
    }
    .gray-right {
        display: flex;
        //width: calc(100% - 50px);
        width: 100%;
        border-bottom: 1px solid #3492d2;
        border-right: 1px solid #3492d2;
        .gray-item{
          width: 25%;
          text-align: center;
          p.td-time {
              width: 100%;
              height: 40px;
              background: rgba(58,105,144,.3);
              border: 1px solid #3492d2;
              line-height: 40px;
              font-size: 14px;
              font-family: Source Han Sans CN;
              font-weight: bold;
              color: #21DDFF;
              border-right: none;
              border-bottom: none;
          }
          
          .td-content{
              width: 100%;
              background: rgba(58,105,144,0);
              border: 1px solid #3492d2;
              border-bottom: 0 none;
              font-size: 14px;
              font-family: DIN;
              color: #FFFFFF;
              border-right: none;
              border-bottom: none;
              //height: calc(100% - 32px);
              //p{
              //  margin-bottom: 2px;
              //}
          }
        }
    }
}

.tableoreca{
  height:30%;
}
.tainwatertable{
  width: 100%;
  // height: 83%;
  height: calc(99% - 85px);
  overflow: hidden;
  margin-bottom: 1%;
   
}
.tableRainwater {
  /deep/ .tainwatertable{
     .el-table__body-wrapper{
     height: calc(100% - 68px);
    }
}

}

.tableRainwater{
  //height:95%;
  height: 28%;
  padding-top: 10px
}


#myTable {
  border-collapse: collapse;
  width: 100%;
}

#myTable th {
  text-align: center;
  color: blue;
  font-weight: bold;
}

#myTable td {
  border: 1px solid black;
  padding: 8px;
  text-align: center;
}

#myTable td:before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  border: 1px solid black;
}
.content_style{
  height: 40px;
  border-bottom:  1px solid #4285A6;
  text-align: center;
  line-height: 40px;

}
.content_style2{
  height: 40px;
  text-align: center;
  line-height: 40px;

}

.tag{
  font-family: 'DIN';
  border-radius: 4px;
  padding: 0 12px;
}
</style>
